﻿using System;
using System.Collections.Generic;
using System.Text;
using SdmxMl.Common;

namespace SdmxMl.Helper
{
    public class TreeImgHelper
    {
        public static int ImgIndexFromAnnotation(AnnotationList annList, int defaultIndex)
        {
            int img = defaultIndex;
            if (annList != null)
            {
                // Specific OFS activities
                string icoCode = annList.GetTextOfAnnotationType("SMS_TYPE");
                if (icoCode.Length > 0)
                {
                    char icodeChar = icoCode[0];
                    if (icodeChar == 'A')
                        img = 6;
                    else if (icodeChar == 'F')
                        img = 12;
                    else if (icodeChar == 'W')
                        img = 7;
                    else if (icodeChar == 'I')
                        img = 10;
                    else if (icodeChar == 'Q')
                        img = 9;
                    else if (icodeChar == 'P')
                        img = 8;
                    else if (icodeChar == 'S')
                        img = 11;
                    else if (icodeChar == 'M')
                        img = 13;
                    else if (icodeChar == 'B')
                        img = 16;
                    else if (icodeChar == 'N')
                        img = 15;
                    else if (icodeChar == 'V')
                        img = 17;
                    else if (icodeChar == 'H')
                        img = 14;
                }
            }


            return img;
        }
    }
}
